package com.example.bbs.domain.entity;


import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.util.Date;
import java.util.Map;

@Data
public class Comment {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String commentId;
    private String userId;
    private String postId;
    @NotBlank(message = "回复内容不能为空！")
    private String content;
    private Integer status;
    private Integer likeCount;
    private Integer hasRead;
    private Date createTime;
    private Date updateTime;



    public static Comment parseMap(Map entries) {
        return JSONObject.parseObject(JSONObject.toJSONString(entries), Comment.class);
    }


    public static Map<String, Object> parseEntry(Comment comment) {
        return JSONObject.parseObject(JSONObject.toJSONString(comment), Map.class);
    }





}
